#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Project: spd-sxmcc
"""
@file: 8.队列.py
@author: lyndon
@time: Created on 2021-01-21 9:53
@env: Python
@desc:
@ref:
@blog:
"""

# queue 本身是线程安全的
# 先进先出
import queue

# q = queue.Queue()
# q.put()
# q.get()

# queue.LifoQueue() # 栈 先进后出

# q = queue.LifoQueue()
# q.put(1)
# q.put(2)
# q.put(3)
# print(q.get())
# print(q.get())
# print(q.get())

# queue.PriorityQueue()
# 优先级队列 优先级小优先级越高
# 优先级一致，则按照value的ascii排序
q = queue.PriorityQueue()
q.put((20, 'a'))
q.put((10, 'b'))
q.put((30, 'c'))
q.put((1, "d"))
q.put((1, "z"))
print(q.get())

